<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>
  "use strict";
  class Preson {
    constructor(name, age) {
      this.name = name;
      this.age = age;
    }
    static host = "https://biadu.com";
    static show() { //可以给对象添加静态方法
      console.log(`大家好`);
    }
    api() { //在方法中调用静态属性
      console.log(`${Preson.host}?cz`);
    }
  };

  let son = new Preson("cz", 19);
  Preson.show(); //调用静态方法
  son.api();
</script>

</html>